package com.module.ble.ui.colorSelection

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.common.app.data.bean.IntelligentTouchOptionModel
import com.module.ble.R
import com.module.ble.utils.LightCustomizeColorConfig


/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：2025/09/30
 *
 * 描述：
 *
 * 修订历史：
 *
 */
class SelectLightColorAdapter : BaseQuickAdapter<IntelligentTouchOptionModel, BaseViewHolder>(R.layout.ble_item_light_customize_color_layout) {

    init {
        addChildClickViewIds(R.id.totalView)
    }

    override fun convert(holder: BaseViewHolder, item: IntelligentTouchOptionModel) {

        holder.setBackgroundResource(R.id.totalView, if (item.isSelect)  R.drawable.bg_round_f5f5f5_8 else 0)

        holder.setImageResource(R.id.imgDef, when(item.id){
            LightCustomizeColorConfig.TYPE_CUS_COLOR_BLUE-> R.drawable.ble_light_color_icon2
            LightCustomizeColorConfig.TYPE_CUS_COLOR_PURPLE-> R.drawable.ble_light_color_icon3
            LightCustomizeColorConfig.TYPE_CUS_COLOR_RED-> R.drawable.ble_light_color_icon4
            LightCustomizeColorConfig.TYPE_CUS_COLOR_ORANGE-> R.drawable.ble_light_color_icon5
            LightCustomizeColorConfig.TYPE_CUS_COLOR_YELLOW-> R.drawable.ble_light_color_icon6
            LightCustomizeColorConfig.TYPE_CUS_COLOR_GREEN-> R.drawable.ble_light_color_icon7
            else ->R.drawable.ble_light_color_icon1
        })
    }
}